package qldc.pm.qlktcsdldc.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import qldc.pm.qlktcsdldc.model.DanhMucSoBanNganh;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import java.util.Date;

/**
 * The cache model class for representing DanhMucSoBanNganh in entity cache.
 *
 * @author Brian Wing Shun Chan
 * @see DanhMucSoBanNganh
 * @generated
 */
public class DanhMucSoBanNganhCacheModel implements CacheModel<DanhMucSoBanNganh>,
    Externalizable {
    public long IDQLKT_DanhMucSoBanNganh;
    public long groupId;
    public long companyId;
    public long userId;
    public String userName;
    public long createDate;
    public long modifiedDate;
    public String TenSoBanNganh;
    public String DiaChi;
    public String SoDienThoai;
    public String Fax;
    public String Email;
    public String NguoiLienHe;
    public String Website;
    public String ChuThich;
    public Boolean deleted;

    @Override
    public String toString() {
        StringBundler sb = new StringBundler(33);

        sb.append("{IDQLKT_DanhMucSoBanNganh=");
        sb.append(IDQLKT_DanhMucSoBanNganh);
        sb.append(", groupId=");
        sb.append(groupId);
        sb.append(", companyId=");
        sb.append(companyId);
        sb.append(", userId=");
        sb.append(userId);
        sb.append(", userName=");
        sb.append(userName);
        sb.append(", createDate=");
        sb.append(createDate);
        sb.append(", modifiedDate=");
        sb.append(modifiedDate);
        sb.append(", TenSoBanNganh=");
        sb.append(TenSoBanNganh);
        sb.append(", DiaChi=");
        sb.append(DiaChi);
        sb.append(", SoDienThoai=");
        sb.append(SoDienThoai);
        sb.append(", Fax=");
        sb.append(Fax);
        sb.append(", Email=");
        sb.append(Email);
        sb.append(", NguoiLienHe=");
        sb.append(NguoiLienHe);
        sb.append(", Website=");
        sb.append(Website);
        sb.append(", ChuThich=");
        sb.append(ChuThich);
        sb.append(", deleted=");
        sb.append(deleted);
        sb.append("}");

        return sb.toString();
    }

    @Override
    public DanhMucSoBanNganh toEntityModel() {
        DanhMucSoBanNganhImpl danhMucSoBanNganhImpl = new DanhMucSoBanNganhImpl();

        danhMucSoBanNganhImpl.setIDQLKT_DanhMucSoBanNganh(IDQLKT_DanhMucSoBanNganh);
        danhMucSoBanNganhImpl.setGroupId(groupId);
        danhMucSoBanNganhImpl.setCompanyId(companyId);
        danhMucSoBanNganhImpl.setUserId(userId);

        if (userName == null) {
            danhMucSoBanNganhImpl.setUserName(StringPool.BLANK);
        } else {
            danhMucSoBanNganhImpl.setUserName(userName);
        }

        if (createDate == Long.MIN_VALUE) {
            danhMucSoBanNganhImpl.setCreateDate(null);
        } else {
            danhMucSoBanNganhImpl.setCreateDate(new Date(createDate));
        }

        if (modifiedDate == Long.MIN_VALUE) {
            danhMucSoBanNganhImpl.setModifiedDate(null);
        } else {
            danhMucSoBanNganhImpl.setModifiedDate(new Date(modifiedDate));
        }

        if (TenSoBanNganh == null) {
            danhMucSoBanNganhImpl.setTenSoBanNganh(StringPool.BLANK);
        } else {
            danhMucSoBanNganhImpl.setTenSoBanNganh(TenSoBanNganh);
        }

        if (DiaChi == null) {
            danhMucSoBanNganhImpl.setDiaChi(StringPool.BLANK);
        } else {
            danhMucSoBanNganhImpl.setDiaChi(DiaChi);
        }

        if (SoDienThoai == null) {
            danhMucSoBanNganhImpl.setSoDienThoai(StringPool.BLANK);
        } else {
            danhMucSoBanNganhImpl.setSoDienThoai(SoDienThoai);
        }

        if (Fax == null) {
            danhMucSoBanNganhImpl.setFax(StringPool.BLANK);
        } else {
            danhMucSoBanNganhImpl.setFax(Fax);
        }

        if (Email == null) {
            danhMucSoBanNganhImpl.setEmail(StringPool.BLANK);
        } else {
            danhMucSoBanNganhImpl.setEmail(Email);
        }

        if (NguoiLienHe == null) {
            danhMucSoBanNganhImpl.setNguoiLienHe(StringPool.BLANK);
        } else {
            danhMucSoBanNganhImpl.setNguoiLienHe(NguoiLienHe);
        }

        if (Website == null) {
            danhMucSoBanNganhImpl.setWebsite(StringPool.BLANK);
        } else {
            danhMucSoBanNganhImpl.setWebsite(Website);
        }

        if (ChuThich == null) {
            danhMucSoBanNganhImpl.setChuThich(StringPool.BLANK);
        } else {
            danhMucSoBanNganhImpl.setChuThich(ChuThich);
        }

        danhMucSoBanNganhImpl.setDeleted(deleted);

        danhMucSoBanNganhImpl.resetOriginalValues();

        return danhMucSoBanNganhImpl;
    }

    @Override
    public void readExternal(ObjectInput objectInput) throws IOException {
        IDQLKT_DanhMucSoBanNganh = objectInput.readLong();
        groupId = objectInput.readLong();
        companyId = objectInput.readLong();
        userId = objectInput.readLong();
        userName = objectInput.readUTF();
        createDate = objectInput.readLong();
        modifiedDate = objectInput.readLong();
        TenSoBanNganh = objectInput.readUTF();
        DiaChi = objectInput.readUTF();
        SoDienThoai = objectInput.readUTF();
        Fax = objectInput.readUTF();
        Email = objectInput.readUTF();
        NguoiLienHe = objectInput.readUTF();
        Website = objectInput.readUTF();
        ChuThich = objectInput.readUTF();
        deleted = objectInput.readBoolean();
    }

    @Override
    public void writeExternal(ObjectOutput objectOutput)
        throws IOException {
        objectOutput.writeLong(IDQLKT_DanhMucSoBanNganh);
        objectOutput.writeLong(groupId);
        objectOutput.writeLong(companyId);
        objectOutput.writeLong(userId);

        if (userName == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(userName);
        }

        objectOutput.writeLong(createDate);
        objectOutput.writeLong(modifiedDate);

        if (TenSoBanNganh == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(TenSoBanNganh);
        }

        if (DiaChi == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(DiaChi);
        }

        if (SoDienThoai == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(SoDienThoai);
        }

        if (Fax == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(Fax);
        }

        if (Email == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(Email);
        }

        if (NguoiLienHe == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(NguoiLienHe);
        }

        if (Website == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(Website);
        }

        if (ChuThich == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(ChuThich);
        }

        objectOutput.writeBoolean(deleted);
    }
}
